//
//  Lesson.m
//  test
//
//  Created by Christian Speich on 12.01.08.
//  Copyright 2008 Christian Speich. All rights reserved.
//

#import "Lesson.h"


@implementation Lesson

- (NSString*) day
{
	return [day copy];
}

- (void) setDay:(NSString*)day_
{
	if (day)
		[day release];
	
	day = [day_ copy];
}

- (NSString*) room
{
	return [room copy];
}

- (void) setRoom:(NSString*)room_
{
	if (room)
		[room release];
	
	room = [room_ copy];
}

- (int) lesson
{
	return lesson;
}

- (void) setLesson:(int)lesson_
{	
	lesson = lesson_;
}

- (NSString*)xml
{
	return [self xmlWithOffset:0];
}

- (NSString*)xmlWithOffset:(int)i
{
	int y;
	NSMutableString* xml = [[NSMutableString alloc] initWithCapacity:50];
	NSMutableString* offset = [[NSMutableString alloc] initWithCapacity:i];
	
	for (y = 0; y < i; y++) {
		[offset appendString:@" "];
	}
	
	[xml appendFormat:@"%@<lesson day=\"%@\" lesson=\"%i\" room=\"%@\" />\n", offset, day, lesson, room];
	
	[offset release];
	
	return xml;
}

- (void) dealloc
{
	[day release];
	[room release];
	
	[super dealloc];
}



@end
